package config

import (
	"log"
	"strconv"

	"github.com/hibiken/asynq"
)

var Asynq *asynq.Client

func InitQueue() {
	if ConfigInstance.Redis.Use && ConfigInstance.Asynq.Use {
		log.Println("Init Queue Asynq config ...")
		addr := ConfigInstance.Redis.Host + ":" + strconv.Itoa(ConfigInstance.Redis.Port)
		r := asynq.RedisClientOpt{Addr: addr}
		Asynq = asynq.NewClient(r)
		log.Println("Queue Client ready ...")
	}
}
